from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as ec
from selenium.webdriver.support.wait import WebDriverWait

from demoSelenium.config.browser_driver import Browser_drvice


class AutoTest_002_dateiframe(object):

    def test_001_dateIframe(self):
        driver = Browser_drvice().browser_init()
        driver.get("https://layui.dev/")

        # 实际过程中，对每个控件的定位，都要做到确定加载
        wait = WebDriverWait(driver, 10)
        # 让组件加载成功，自动计时等待
        locator = (By.XPATH, '//a[@href="/docs/2/"]')
        # visibility_of_element_located -- 元素已经出现
        wait.until(ec.visibility_of_element_located(locator)).click()

        # locator2 =(By.XPATH,'/html/body/div[2]/div[1]/ul/li[6]/ul/li[2]/div/a')
        #  visibility_of_element_located 元素已经出现
        # wait.until(ec.visibility_of_element_located(locator2)).click()


    def test_002_dateIframe(self):
        driver = Browser_drvice().browser_init()
        driver.get("https://layui.dev/docs/2/laydate/#demo-type")

        # 实际过程中，对每个控件的定位，都要做到确定加载
        wait = WebDriverWait(driver, 10)
        # 移动窗口
        driver.set_window_position(1900, -200)
        driver.set_window_size(1550, 1000)

        driver.find_elements(By.ID, "")

        # 让组件加载成功，自动计时等待
        locator = (By.XPATH, '//"]')
        # visibility_of_element_located -- 元素已经出现
        wait.until(ec.visibility_of_element_located(locator)).click()

        # locator2 =(By.XPATH,'/html/body/div[2]/div[1]/ul/li[6]/ul/li[2]/div/a')
        # # visibility_of_element_located -- 元素已经出现
        # wait.until(ec.visibility_of_element_located(locator2)).click()


if __name__ == '__main__':
    AutoTest_002_dateiframe().test_001_dateIframe()
